
import React, { useState, useEffect, useContext } from 'react';

import {Context} from "../index.js"

export default function(props){
    const [count, setCount] = useState(5)

    useEffect(() => {
        setTimeout(() => {
            if(count > 0) {
                setCount(count -1)
            }
        }, 1000)
    }, [count])
    let params = useContext(Context)
    // console.log("函数组件",params)
  return (
    <div>
        函数组件 ， 拿到的值是：{params.activeKey}
        <button onClick={params.change} > 点击触发 父组件 中的方法  </button>
        <div>
            count：{count}
        </div>
    </div>
  )
}
